<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Grade Bay</title>
		<link rel="stylesheet" href="gui.css" type="text/css" />
                <link rel="stylesheet" href="style.css" type="text/css" />
		<!--[if IE 7]>
			<link rel="stylesheet" href="css/ie7.css" type="text/css" />
		<![endif]-->
                
                 <script language="javascript">
                    function prompt(){
                        var question = confirm("Are you sure you want to delete this teacher?");
                        if(question)
                           return true;
                        
                        else return false;
                           
                    }
                    
                </script>
	</head>
	<body>
		<div class="page">
			<div class="header">
				<a href="index.php" id="logo"><img src="images/gradeBaylogo.png" width="330" height="79" alt=""/></a>
				<ul>
					<li class="selected"><a href="">VIEW TEACHERS </a></li>
                                        <li><a href="view.php">BACK</a></li>
				
				</ul>
			</div>
			<div class="body">

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
    include 'PHPClasses/DBAccess.php';
    include 'PHPClasses/Teacher.php';
    include 'PHPClasses/TeacherDBAccess.php';
      
    
    $DBAccess=new TeacherDBAccess;
    
    
    $teacherList=$DBAccess->viewDB();
    
    echo "<table id=hor-minimalist-a cellspacing='15'>";
    echo "<thead><th colspan='1' scope=col>Teachers</th>
    <th colspan='2' scope=col>In charge of Level/s</th></thead>";
                
     if(mysql_num_rows($teacherList)<=1){
                        echo "<td scope=col>No Teachers Added!</td>";
      }
                  
         while ($teacherRow = mysql_fetch_array($teacherList))
                {
                    extract($teacherRow);

                   
                    if($teacherName!="NONE"){
                        echo "<tr>\n
                        <td><a href='editTeacher.php?teacherID=".$idTeacher."' style='text-decoration:none; color:#636363;'>$teacherName</td>\n";
        
                    }
                    
                    $teacherlevel=$DBAccess->getTeacherLevelsFromDB($idTeacher);
                    
                    while ($levelRow = mysql_fetch_array($teacherlevel)){
                        extract($levelRow);
                        if($teacherName!="NONE"){
                          echo" <td>$Level</td>\n";
                        }
                    
                    }

                    if($teacherName!="NONE"){
                        
                    echo "
                        <td><form name='teacherIDform' action='deleteTeacher.php' onsubmit='return prompt()' method='POST'>
                        <input type='hidden' value='$idTeacher' name='teacherID'/><input class='addmore' type='submit' value='Delete'/>\n
                        </form></td>
                        </tr>\n";
                    }

                }
                echo "</table>\n";
    
   $DBAccess->DBDisconnect();
   
?>
                         
                        </div>
                    
			<div class="footer">
				
				<p>&#169; Copyright &#169; 2011. Company name all rights reserved</p>
				<div class="connect">
					<a href=""><img src="images/paragox.png" width=160" height="110" alt=""/></a>
					<a href=""><img src="images/fblogo.png" width=120" height="100" alt="" style="position:relative; left:-31px"/></a>
					<a href=""><img src="images/harmony.png" width=120" height="100" alt="" style="position:relative; left:0px"/></a>
				</div>
			</div>
		</div>
	</body>
</html> 